<html>
  <head>
    <script src="../dist/skulpt.min.js" type="text/javascript"></script>
    <script src="../dist/skulpt-stdlib.js" type="text/javascript"></script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"> </script>
  </head>

  <body>
    <div id="mycanvas"  height="500" width="800"
	style="border-style: solid;"></div>

<textarea id="code" rows="24" cols="80">
import turtle
wn = turtle.Screen()

babbage = turtle.Turtle()
babbage.shape("triangle")

n = 8
angle = 360/n

for i in range(n):
    babbage.right(angle)
    babbage.forward(90)
    babbage.stamp()

wn.exitonclick()
</textarea>
    <script>
        var prog = document.getElementById("code").value;
	function builtinRead(x) {
	    if (Sk.builtinFiles === undefined || Sk.builtinFiles["files"][x] === undefined)
		    throw "File not found: '" + x + "'";
	    return Sk.builtinFiles["files"][x];
	}
    (Sk.TurtleGraphics || (Sk.TurtleGraphics = {})).target = 'mycanvas';

    Sk.configure({ read: builtinRead });

    Sk.misceval.asyncToPromise(function() {
      return Sk.importMainWithBody("<stdin>",false,prog,true);
    });
    </script>
  </body>
</html>
